package com.bw.module_house.adapter

import android.view.View
import android.widget.ImageView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.bw.module_house.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
/**
 * 智慧园区-03-房源信息V1.1-史建军-20250514
 */
class ItemHouseAdapter(private val adapter:HouseAdapter):BaseQuickAdapter<String,BaseViewHolder>(R.layout.item_house) {
    private var isShow:Boolean=false
    override fun convert(holder: BaseViewHolder, item: String) {
        holder.setText(R.id.tv_several,item)
        holder.setText(R.id.tv_num,"2200㎡")
        val house=holder.getView<RecyclerView>(R.id.rv_type_home)
       holder.getView<ImageView>(R.id.iv_check).apply {
            setOnClickListener{
                isShow=!isShow
                if (isShow) house.visibility=View.VISIBLE else house.visibility=View.GONE
            }
        }
        house.layoutManager=LinearLayoutManager(context,LinearLayoutManager.HORIZONTAL ,false)
        house.adapter=adapter
    }
}